/*
 * Toolkit.java
 *
 * Created on 2005/02/28 +0900
 *
 * $Revision: 58 $
 * $Date: 2008-12-06 08:59:45 +0000 (Sat, 06 Dec 2008) $
 */

package org.gikolet.framework;

import org.gikolet.framework.application.Application;
import org.gikolet.framework.application.ApplicationRequestProcesser;
import org.gikolet.framework.inject.Injector;
import org.gikolet.framework.io.storage.Scratchpad;
import org.gikolet.framework.platform.PlatformDependentFunction;
import org.gikolet.framework.ui.Display;
import org.gikolet.framework.util.Assert;

/**
 * @author Tetsutaro (latest modification by $Author: tetsutaro.ss $)
 * @version $Revision: 58 $ $Date: 2008-12-06 08:59:45 +0000 (Sat, 06 Dec 2008) $
 */
public final class Toolkit {
    private static Injector injector;

    private Toolkit() {
    }

    public static void service(Injector injector) {
	Toolkit.injector = injector;
    }

    public static Display getDisplay() {
	Assert.isNotNull(Toolkit.injector);

	return (Display) Toolkit.injector.getInstance(Display.class);
    }

    public static ApplicationRequestProcesser getRequestProcesser() {
	Assert.isNotNull(Toolkit.injector);

	return (ApplicationRequestProcesser) Toolkit.injector
		.getInstance(ApplicationRequestProcesser.class);
    }

    public static PlatformDependentFunction getPlatformDependentFunction() {
	Assert.isNotNull(Toolkit.injector);

	return (PlatformDependentFunction) Toolkit.injector
		.getInstance(PlatformDependentFunction.class);
    }

    public static Scratchpad getScratchpad() {
	Assert.isNotNull(Toolkit.injector);

	return (Scratchpad) Toolkit.injector.getInstance(Scratchpad.class);
    }

    public static Application getApplication() {
	Assert.isNotNull(Toolkit.injector);

	return (Application) Toolkit.injector.getInstance(Application.class);
    }
}
